package classes;

import pt.iscte.osgi.contracts.annotations.MethodRequired;
import pt.iscte.osgi.contracts.annotations.Negative;
import pt.iscte.osgi.contracts.annotations.Positive;
import pt.iscte.osgi.contracts.annotations.Require;
import pt.iscte.osgi.contracts.annotations.Requires;

public class D implements ConstantInterface{

	final Integer ID = 1;
	boolean on;
	
	@Positive
	int value1;
	
	@Negative
	double value2;
	
	float value3;
	int value4;
	double value5;
	float value6;	
	
	public D(boolean on){
		this.on = on;
	}
	
	public D(@Positive float val1, @Negative int val2){
		this.value3 = val1;
		this.value4 = val2;
	}

	public void setValue1(int val){
		this.value1 = val;
	}
	
	public void setValue2(double val){
		this.value2 = val;
	}
	
	public void setValue3(float val){
		this.value3 = val;
	}
	
	public void setValue4(int val){
		this.value4 = val;
	}
	
	@Positive
	public float getValue3(){
		return value3;
	}
	
	@Negative
	public int getValue4(){
		return value4;
	}
	
	public void setValue5(@Positive double val){
		this.value5 = val;
	}
	
	public void setValue6(@Negative float val){
		this.value6 = val;
	}

	@Requires(@MethodRequired)
	public void run(){
		//do something
	}
	
	@MethodRequired
	public boolean isOn(){
		return on;
	}
	
	@Require("isOff")
	public void stop(){
		
	}
	
	public boolean isOff(){
		return !on;
	}
}
